# -*- coding: utf-8 -*-
import os
import oss2

def aliyun_files_uploading(files):
    auth = oss2.Auth('LTAI5tDQPQ8SXihJs2cyuruM', '4sYStNi4FcR4KwQKZli6s6Puhubp40')
    bucket = oss2.Bucket(auth, 'https://oss-cn-beijing.aliyuncs.com', 'boss-files-save')

    # with open('../voice/test.mp3', 'rb') as fileobj:
    #     bucket.put_object('voice_files/test.mp3', fileobj)

    bucket.put_object('voice_files/images.jpg', files)


def aliyun_files_download(files_name):
    auth = oss2.Auth('LTAI5tDQPQ8SXihJs2cyuruM', '4sYStNi4FcR4KwQKZli6s6Puhubp40')
    bucket = oss2.Bucket(auth, 'https://oss-cn-beijing.aliyuncs.com', 'boss-files-save')
    bucket.get_object_to_file('voice_files/%s'%files_name, 'D:\\Download\a.jpg')